import 'dart:ui' as ui show BoxHeightStyle, BoxWidthStyle;

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';

import '../form/input_decoration_utils.dart';

/// A Material Design text field input.
class MyFormBuilderTextField extends FormBuilderTextField {
  MyFormBuilderTextField({
    super.key,
    required super.name,
    super.validator,
    super.decoration,
    super.onChanged,
    super.valueTransformer,
    super.enabled,
    super.onSaved,
    super.autovalidateMode = AutovalidateMode.disabled,
    super.onReset,
    super.focusNode,
    super.restorationId,
    super.initialValue,
    super.readOnly = false,
    super.maxLines = 1,
    super.obscureText = false,
    super.textCapitalization = TextCapitalization.none,
    super.scrollPadding = const EdgeInsets.all(20.0),
    super.enableInteractiveSelection = true,
    super.maxLengthEnforcement,
    super.textAlign = TextAlign.start,
    super.autofocus = false,
    super.autocorrect = true,
    super.cursorWidth = 2.0,
    super.cursorHeight,
    super.keyboardType,
    super.style,
    super.controller,
    super.textInputAction,
    super.strutStyle,
    super.textDirection,
    super.maxLength,
    super.onEditingComplete,
    super.onSubmitted,
    super.inputFormatters,
    super.cursorRadius,
    super.cursorColor,
    super.keyboardAppearance,
    super.buildCounter,
    super.expands = false,
    super.minLines,
    super.showCursor,
    super.onTap,
    super.onTapOutside,
    super.enableSuggestions = true,
    super.textAlignVertical,
    super.dragStartBehavior = DragStartBehavior.start,
    super.scrollController,
    super.scrollPhysics,
    super.selectionWidthStyle = ui.BoxWidthStyle.tight,
    super.smartDashesType,
    super.smartQuotesType,
    super.selectionHeightStyle = ui.BoxHeightStyle.tight,
    super.autofillHints,
    super.obscuringCharacter,
    super.mouseCursor,
    super.contextMenuBuilder,
    super.magnifierConfiguration,
    super.contentInsertionConfiguration,
    super.spellCheckConfiguration,
    super.clipBehavior = Clip.hardEdge,
    super.canRequestFocus = true,
    super.cursorErrorColor,
    super.cursorOpacityAnimates,
    super.enableIMEPersonalizedLearning = true,
    super.groupId = EditableText,
    super.onAppPrivateCommand,
    super.onTapAlwaysCalled = false,
    super.scribbleEnabled = true,
    super.selectionControls,
    super.statesController,
    super.undoController,
  });
}

/// A Material Design text field input.
class MyFormBuilderSelect extends MyFormBuilderTextField {
  MyFormBuilderSelect({
    super.key,
    required super.name,
    super.validator,
    super.decoration,
    super.onChanged,
    super.valueTransformer,
    super.enabled,
    super.onSaved,
    super.autovalidateMode,
    super.onReset,
    super.focusNode,
    super.restorationId,
    super.initialValue,
    super.readOnly = true,
    super.maxLines,
    super.obscureText,
    super.textCapitalization,
    super.scrollPadding,
    super.enableInteractiveSelection,
    super.maxLengthEnforcement,
    super.textAlign,
    super.autofocus,
    super.autocorrect,
    super.cursorWidth,
    super.cursorHeight,
    super.keyboardType,
    super.style,
    super.controller,
    super.textInputAction,
    super.strutStyle,
    super.textDirection,
    super.maxLength,
    super.onEditingComplete,
    super.onSubmitted,
    super.inputFormatters,
    super.cursorRadius,
    super.cursorColor,
    super.keyboardAppearance,
    super.buildCounter,
    super.expands,
    super.minLines,
    super.showCursor,
    super.onTap,
    super.onTapOutside,
    super.enableSuggestions,
    super.textAlignVertical,
    super.dragStartBehavior,
    super.scrollController,
    super.scrollPhysics,
    super.selectionWidthStyle,
    super.smartDashesType,
    super.smartQuotesType,
    super.selectionHeightStyle,
    super.autofillHints,
    super.obscuringCharacter,
    super.mouseCursor,
    super.contextMenuBuilder,
    super.magnifierConfiguration,
    super.contentInsertionConfiguration,
    super.spellCheckConfiguration,
    super.clipBehavior,
    super.canRequestFocus,
    super.cursorErrorColor,
    super.cursorOpacityAnimates,
    super.enableIMEPersonalizedLearning,
    super.groupId = EditableText,
    super.onAppPrivateCommand,
    super.onTapAlwaysCalled,
    super.scribbleEnabled,
    super.selectionControls,
    super.statesController,
    super.undoController,
  });
}

class MyInputDecoration extends InputDecoration {
  const MyInputDecoration({
    super.icon,
    super.iconColor,
    super.label,
    super.labelText,
    super.labelStyle,
    super.floatingLabelStyle,
    super.helper,
    super.helperText,
    super.helperStyle,
    super.helperMaxLines,
    super.hintText,
    super.hintStyle,
    super.hintTextDirection,
    super.hintMaxLines,
    super.hintFadeDuration,
    super.error,
    super.errorText,
    super.errorStyle,
    super.errorMaxLines,
    super.floatingLabelBehavior,
    super.floatingLabelAlignment,
    super.isCollapsed,
    super.isDense,
    super.contentPadding = const EdgeInsets.only(bottom: 6),
    super.prefixIcon,
    super.prefixIconConstraints,
    super.prefix,
    super.prefixText,
    super.prefixStyle,
    super.prefixIconColor,
    super.suffixIcon,
    super.suffix,
    super.suffixText,
    super.suffixStyle,
    super.suffixIconColor,
    super.suffixIconConstraints = InputDecUtils.defSuffixIconConstraints,
    super.counter,
    super.counterText,
    super.counterStyle,
    super.filled,
    super.fillColor,
    super.focusColor,
    super.hoverColor,
    super.errorBorder,
    super.focusedBorder,
    super.focusedErrorBorder,
    super.disabledBorder,
    super.enabledBorder,
    super.border,
    super.enabled = true,
    super.semanticCounterText,
    super.alignLabelWithHint,
    super.constraints,
  });
}

class MySelectDecoration extends InputDecoration {
  const MySelectDecoration({
    super.icon,
    super.iconColor,
    super.label,
    super.labelText,
    super.labelStyle,
    super.floatingLabelStyle,
    super.helper,
    super.helperText,
    super.helperStyle,
    super.helperMaxLines,
    super.hintText,
    super.hintStyle,
    super.hintTextDirection,
    super.hintMaxLines,
    super.hintFadeDuration,
    super.error,
    super.errorText,
    super.errorStyle,
    super.errorMaxLines,
    super.floatingLabelBehavior,
    super.floatingLabelAlignment,
    super.isCollapsed,
    super.isDense,
    super.contentPadding = const EdgeInsets.only(bottom: 6),
    super.prefixIcon,
    super.prefixIconConstraints,
    super.prefix,
    super.prefixText,
    super.prefixStyle,
    super.prefixIconColor,
    super.suffixIcon = InputDecUtils.moreIcon,
    super.suffixIconConstraints = InputDecUtils.defSuffixIconConstraints,
    super.suffix,
    super.suffixText,
    super.suffixStyle,
    super.suffixIconColor,
    super.counter,
    super.counterText,
    super.counterStyle,
    super.filled,
    super.fillColor,
    super.focusColor,
    super.hoverColor,
    super.errorBorder,
    super.focusedBorder,
    super.focusedErrorBorder,
    super.disabledBorder,
    super.enabledBorder,
    super.border,
    super.enabled,
    super.semanticCounterText,
    super.alignLabelWithHint,
    super.constraints,
  });
}
